package com.jiyun.controller;


import com.jiyun.entity.day06.Contest;
import com.jiyun.feign.ContestFeign;
import com.jiyun.vo.ResponseBean;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("contest")
public class ContestController {
    @Resource
    private ContestFeign contestFeign;

    /**
     * 查看所有比赛
     * @param contest
     * @return
     */
    @RequestMapping("findByAll")
    public ResponseBean findByAll(@RequestBody Contest contest) {
        return contestFeign.findByAll(contest);
    }
    @RequestMapping("findByContestId")
    public ResponseBean findByContestId(@RequestParam Integer id) {
        return contestFeign.findByContestId(id);
    }

    /**
     * 添加用户和比赛中间表信息
     * @param id
     * @param squadsId
     * @return
     */
    @RequestMapping("addUserContest")
    public ResponseBean addUserContest(@RequestParam Integer id,@RequestParam Integer squadsId) {
            return contestFeign.addUserContest(id,squadsId);
    }

    /**
     * 根据培训id查询战队名称
     * @param contestId
     * @return
     */
    @RequestMapping("findByContestByName")
    public ResponseBean findByContestByName(@RequestParam Integer contestId) {
        return contestFeign.findByContestByName(contestId);
    }
    /**
     * 根据培训id，查询测验
     */
    @RequestMapping("findContestByTraining")
    public ResponseBean findContestByTraining(@RequestParam Integer id) {
        return contestFeign.findContestByTraining(id);
    }

}
